<template>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
    <el-form-item label="名称">
      <el-input v-model="formInline.user" label="名称" placeholder="商品名称"></el-input>
    </el-form-item>
    <el-form-item label="分类">
      <el-button type="primary" @click="onSubmit">查询</el-button>
      <el-button type="primary" @click="addSubmit">添加</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
//引入api
import {getAdminBrand} from '@/request/api.js';

export default {
  data() {
    return {
      formInline: {}
    };
  },
  // 方法
  methods: {
    onSubmit() {
       getAdminBrand({
        name:this.formInline.user,
        pages:this.$store.state.brand.pageSize,
        currentPage:this.$store.state.brand.currentPage,
      }).then(res=>{
        this.$store.commit('getBrandList',res.data)
      })

    },
    addSubmit() {
      this.$router.push("/addbrand");
    }
  }
}
</script>
<style lang='less' scoped>
.el-form {
  background-color: #fff;
}

</style>